package cn.birdbaby.plugins;

import com.intellij.ide.actions.CreateClassAction;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.util.NlsActions;
import com.intellij.psi.PsiClass;
import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.util.Map;
import java.util.function.Supplier;

/**
 * @author llorando 3/8/24 10:43 pm
 */
public class MyCreateClassAction extends CreateClassAction {
    public MyCreateClassAction() {
        Presentation presentation = getTemplatePresentation();
        presentation.setText("bb java class");
        presentation.setDescription("skoask");
        presentation.setIcon(PlatformIcons.CLASS_ICON);
    }

    public MyCreateClassAction(@NotNull Supplier<@NlsActions.ActionText String> dynamicText,
                               @NotNull Supplier<@NlsActions.ActionDescription String> dynamicDescription,
                               @Nullable Icon icon) {
        Presentation presentation = getTemplatePresentation();
        presentation.setText(dynamicText);
        presentation.setDescription(dynamicDescription);
        presentation.setIcon(icon);
    }

    @Override
    protected void postProcess(@NotNull PsiClass createdElement, String templateName, Map<String, String> customProperties) {
        super.postProcess(createdElement, templateName, customProperties);
        System.out.println("jasjajs");
    }
}
